﻿<%@ Page Language="C#" MasterPageFile="~/Tenmah.Master" AutoEventWireup="true" CodeBehind="Manage_users.aspx.cs" Inherits="Tenmah.Web.Administrator.Manage_users" Title="Untitled Page" %>
<%@ Register TagPrefix="tmh" TagName="MessageBox" Src="~/Components/MessageBox.ascx" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script type="text/javascript" language="javascript" src="../Js/TenmahScripts.js"></script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="SubmenuContentPlaceHolder" runat="server">
    <table border="0" cellpadding="0" cellspacing="0" >
	    <tr>
    		<td style="background: url('../images/submenu_left.jpg') no-repeat; width: 6px; height: 20px;">
	        </td>
      		<td style="background: url('../images/submenu_center.jpg') repeat-x; height: 20px;">
      		    <asp:Button ID="AddUserButton" runat="server" Text="Создать" CssClass="button_transparent_bold" PostBackUrl="~/Administrator/EditUser.aspx" />
                <asp:Button ID="DeleteUserButton" runat="server" Text="Удалить" CssClass="button_transparent_bold" OnClick="DeleteUserButton_Click" />
            </td>
      		<td style="background: url('../images/submenu_right.jpg') no-repeat; width: 6px; height: 20px;">
	        </td>
	    </tr>
    </table>    
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="ContentTitleContentPlaceHolder" runat="server"> 
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:Repeater ID="UsersRepeater" runat="server" OnItemCommand="UsersRepeater_ItemCommand">
        <HeaderTemplate>
            <table  border="0" cellpadding="0" cellspacing="0" width="100%" class="list_view">
                <tr class="list_view_header">
                    <th style="padding: 2px;">
                        <asp:CheckBox ID="InverseSelectionCheckBox" runat="server" />
                    </th>
                    <th style="padding: 2px;">                   
                        <asp:LinkButton ID="SortByLogOnLinkButton" runat="server" OnClick="SortByLogOnLinkButton_Click" >Логин</asp:LinkButton>                                    
                    </th>
                    <th style="padding: 2px;">                   
                        <asp:LinkButton ID="SortByLastNameLinkButton" runat="server" OnClick="SortByLastNameLinkButton_Click" >Фамилия</asp:LinkButton>                                    
                    </th>
                    <th style="padding: 2px;">                   
                        <asp:LinkButton ID="SortByFirstNameLinkButton" runat="server" OnClick="SortByFirstNameLinkButton_Click" >Имя</asp:LinkButton>                                    
                    </th>
                    <th style="padding: 2px;">                   
                        <asp:LinkButton ID="SortByMiddleNameLinkButton" runat="server" OnClick="SortByMiddleNameLinkButton_Click" >Отчество</asp:LinkButton>                                    
                    </th>
                    <th style="padding: 2px;">
                        <asp:LinkButton ID="SortByFacultyLinkButton" runat="server" OnClick="SortByFacultyLinkButton_Click">Факультет</asp:LinkButton>  
                    </th>
                    <th style="padding: 2px;">
                        <asp:LinkButton ID="SortByCafhedraLinkButton" runat="server" OnClick="SortByCafhedraLinkButton_Click">Кафедра</asp:LinkButton>  
                    </th>
                    <th style="padding: 2px;">
                        <asp:LinkButton ID="SortByCourseLinkButton" runat="server" OnClick="SortByCourseLinkButton_Click">Курс</asp:LinkButton>  
                    </th>
                    <th style="padding: 2px;">
                        <asp:LinkButton ID="SortByGroupLinkButton" runat="server" OnClick="SortByGroupLinkButton_Click">Группа</asp:LinkButton>  
                    </th>
                    <th style="padding: 2px;">
                        <asp:LinkButton ID="SortByRoleLinkButton" runat="server" OnClick="SortByRoleLinkButton_Click">Роль</asp:LinkButton>  
                    </th>
                    <th style="padding: 2px;">   
                                   
                    </th>
                    <th style="padding: 2px;">   
                                   
                    </th>
                </tr>
        </HeaderTemplate>    
        <ItemTemplate>
                <%# Container.ItemIndex % 2 == 0 ? "<tr class=\"list_view_item\">" : "<tr class=\"list_view_alternating_item\">" %>
                    <td>
                        <asp:CheckBox ID="SelectUserCheckBox" runat="server" />
                        <asp:HiddenField ID="UserIdHiddenField" runat="server" Value='<%# Eval("Id") %>' />
                    </td>
                    <td style="padding: 2px;">
                        <asp:Label ID="LogOnLabel" runat="server" Text='<%# Eval("LogOn") %>' />
                    </td>
                    <td style="padding: 2px;">
                        <asp:Label ID="LastNameLabel" runat="server" Text="--" />
                    </td>
                    <td style="padding: 2px;">
                        <asp:Label ID="FirstNameLabel" runat="server" Text="--" />
                    </td>
                    <td style="padding: 2px;">
                        <asp:Label ID="MiddleNameLabel" runat="server" Text="--" />
                    </td>
                    <td style="padding: 2px;">
                        <asp:Label ID="FacultyLabel" runat="server" Text="--" />
                    </td>
                    <td style="padding: 2px;">
                        <asp:Label ID="CafherdaLabel" runat="server" Text="--" />
                    </td>
                    <td style="padding: 2px;">
                        <asp:Label ID="CourseLabel" runat="server" Text="--" />
                    </td>
                    <td style="padding: 2px;">
                        <asp:Label ID="GroupLabel" runat="server" Text="--" />
                    </td>
                    <td style="padding: 2px; text-align: left;">
                        <asp:Repeater ID="RolesRepeater" runat="server" DataSource='<%# Eval("UserRoles") %>'>
                            <HeaderTemplate>
                                <ul style="font-size: 8pt;">
                            </HeaderTemplate>
                            <ItemTemplate>
                                <li>
                                    <asp:HiddenField ID="RoleIdHiddenField" runat="server" Value='<%# Eval("Id") %>' />
                                    <asp:Label ID="RoleTitleLabel" runat="server" Text='<%# Eval("Title") %>'></asp:Label>                            
                                </li>
                            </ItemTemplate>
                            <FooterTemplate>
                                </ul>
                            </FooterTemplate>
                        </asp:Repeater>   
                    </td>
                    <td style="padding: 2px;">
                        <asp:Label ID="MessageLabel" runat="server" Text="" />
                    </td>
                    <td style="padding: 2px;">                    
                        <a href='../Administrator/EditUser.aspx?UserId=<%# Eval("Id") %>' class="link_button_green">изменить</a>
                        <br />
                        <asp:LinkButton ID="DeleteLinkButton" runat="server" Text="удалить" CommandName="Delete" CommandArgument='<% Eval("Id") %>' CssClass="link_button_red" />
                    </td>
                </tr>
        </ItemTemplate>
        <FooterTemplate>            
            </table>
        </FooterTemplate>
    </asp:Repeater>
</asp:Content>
